home *** CD-ROM | disk | FTP | other *** search
- FOREACH.EXE
-
- Class: UNIX
-
- Repeat keyboard commands for a series of files or options.
-
- NAME
- FOREACH Repeat commands
-
- SYNOPSIS
- foreach [-v] <variable> list | @file
-
- DESCRIPTION
- Foreach will repeat a series of commands substituting the current
- value of the variable during each pass. The variable is accessed by
- placing a '$' in front of the choosen letter. For example, if the
- variable if f than $f would be used in the command line.
-
- OPTIONS
- The below list are modifiers for use with the replacement
- variable:
- :e replaces with extension (d:\path\file.ext -> ext)
- :h replaces with head of path (d:\path\file.ext -> d:\path)
- :n replaces with name of file (d:\path\file.ext -> file)
- :r replaces with root of file (d:\path\file.ext -> d:\path\file)
- :t replaces with tail of file (d:\path\file.ext -> file.ext)
-
- The use of the -v option prior to declaring the variable will enable
- the verbose mode. In this mode each command will be displayed on the
- screen prior to execution.
-
- EXAMPLES
- foreach -v f *.c
- del $f:n.obj
- del $f:n.exe
- end
-
- In the above example all files that are present as .C files will
- have thier associated .OBJ and .EXE files deleted. The series of
- commands is terminated by the word end or END.
-
- foreach r @files
- copy $f \batch
- del $f
- end
-
- In this case the files to be operated upon are in the file 'files'.
- The preface of '@' on the foreach command line instructs the program
- to obtain the files list from a file.
-